package com.kedacom.ctsp.authz.security;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * Authz配置文件
 *
 * @author xuwei
 * @create 2017-11-30 10:26
 **/
@ConfigurationProperties(prefix = "commons.authz.security")
@Data
public class AuthzSecurityProperties {

    private Integer tokenValiditySeconds = 86400;
    private String rememberMeCookieName = "ctsp_remember_me";
    private String rememberMeParameter = "remember_me";

//    private String adminAccessPermission = "hasRole('ADMIN')";
//    private String userAccessPermission = "hasRole('USER')";

    private String loginUsernameParam = "username";
    private String loginPasswordParam = "password";

    private String expiredUrl = "/auth/login";
    private String loginUrl = "/auth/login";
    /**
     * 页面html
     */
    private String loginPageUrl = "/login.html";
    private String loginProcessingUrl = "/auth/login";
    private String defaultSuccessUrl = "/";
    private String accessDeniedUrl = "/auth/deny";
    private String logoutUrl = "/auth/logout";
    private String logoutSuccessUrl = "/auth/login";
    private String loginTokenUrl = "/auth/login_token";
    /**
     * 未授权
     */
    private String unauthorizedUrl = "/auth/unauthorized";
    /**
     * 客户端登录地址
     */
    private String clientLoginUrl = "/oauth2/authorize";

    private String[] permitAllUrl = {"/", "/css/**", "/js/**", "/img/**", "/static/**", "/public/**", "/auth/**"};

    /**
     * 同一个账户允许同时在线的数量
     */
    private Integer maximumSessions = 1;

    private String defaultRolePrefix = "ROLE_";

    private String authCode = "tHrhuWzl7pmdAk4a";

    /**
     * 默认为一天
     */
    private int expireTime = 24 * 60;

}
